import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from 'typeorm';
import { Ad } from "./ad.entities";
import { ApiProperty} from '@nestjs/swagger';
import { IsOptional } from 'class-validator';

@Entity()
export class AdPosition {
  @PrimaryGeneratedColumn({type: 'tinyint'})
  id: number;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'varchar' ,length: 60 })
  name: string;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'smallint' ,width: 5 })
  width: number;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'smallint' ,width: 5 })
  height: number;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'varchar', length: 255})
  desc: string;

  @OneToMany(type => Ad, ad => ad.adPosition)
  ads: Ad[];
}
